package com.kaba.zplb.controller;

import com.kaba.bean.ResponseResult;
import com.kaba.bean.mongodb.ZuoPin;
import com.kaba.zplb.service.impl.WorksServiceimpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author user
 * @Date 2021/3/11/011
 * @Description TODO
 */
@RestController
@RequestMapping("works")
@CrossOrigin
public class WorksController{
    @Autowired
    private WorksServiceimpl worksService;
    //综合查询列表显示
    @GetMapping("/queryWorks")
    public ResponseResult queryWorks(ZuoPin zuoPin){
        List<ZuoPin> worksList = worksService.queryWorks(zuoPin);
        return  ResponseResult.success(worksList);
    }
    //作品奖金申请列表显示
    @GetMapping("/banjiangWorks")
    public ResponseResult banjiangWorks(ZuoPin zuoPin){
        List<ZuoPin> worksList = worksService.banjiangWorks(zuoPin);
        return ResponseResult.success(worksList);
    }
    //作品名次申请列表显示
    @GetMapping("/mingciWorks")
    public ResponseResult mingciWorks(ZuoPin zuoPin){
        List<ZuoPin> worksList = worksService.mingciWorks(zuoPin);
        return ResponseResult.success(worksList);
    }
    //修改作者以下所有作品
    @PostMapping("updaWorks")
    public ResponseResult updaWorks(String nickname){
        worksService.updateWorks(nickname);
        return ResponseResult.success();
    }
}
